/*
 * Exploder
 * 
 * Tero Pyylampi (218437), Jussi Tuurinkoski (211594)
 *
 * Level Editor scene
 */

#ifndef EDITORSCENE_H
#define EDITORSCENE_H

#include "cocos2d.h"
#include <iostream>
#include <fstream>

class MainEngine;
class EditorLayer;
class LayerBackground;
class EditorLayerInterface;
class GameCamera;

class EditorScene : public cocos2d::CCScene
{
public:
	// default constructor
	EditorScene( MainEngine *mainEngine );
	// default destructor
	~EditorScene();

	// initialize this scene
	void initScene();

	// update -function
	virtual void update( cocos2d::ccTime dt );

	// create a new empty level
	void createNewLevel();
	// save current level (asks for filename if name = 0)
	void saveCurrentLevel( char *fileName );
	// load wanted level (asks for filename if name = 0)
	void loadLevel( char *fileName );
	// exit the editor and return to menu
	void exitEditor();
	
	// get master
	MainEngine *getMainEngine();
	// get camera
	GameCamera *getGameCamera();

	// get editor layer
	EditorLayer *getEditorLayer();
	// get interface layer
	EditorLayerInterface *getInterfaceLayer();

private:
	// pointer to the main engine
	MainEngine *mMainEngine;

	// parallax node containing game layer & it's background
	cocos2d::CCParallaxNode *mParallaxNode;
	// editor layer & it's background
	EditorLayer *mEditorLayer;
	LayerBackground *mEditorLayerBackground;
	EditorLayerInterface *mEditorLayerInterface;

	// camera object for coordinate transformations & moving world
	GameCamera *mGameCamera;

	// saves objects into a file
	void savePhysicObjectsIntoFile( ofstream &file );
};

#endif